package com.example.aopdemo.aspect;

/*
 * @author zzr
 * @date: 2025/10/03  13:06
 * @description:
 */

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Slf4j
public class MyAspectDemo {

    @Around("@annotation(com.example.aopdemo.config.MyAspect)")
    public Object doAround(ProceedingJoinPoint pjp) {
        log.info("do around before..");

        Object o = null;
        try {
            o = pjp.proceed();
        } catch (Throwable e) {
            log.error("发生异常,e",e);
        }
        log.info("do around after...");
        return o;
    }
}
